#pragma once

#include"Common.h"
#include"BaseInfo.h"

class InfoClass
{
public:
	void Initialize();
	void OnFrame();
	void OnUnitMorph(Unit* unit);
	BaseInfo* AssignMeToMineral(Unit* worker);
	BaseInfo* GetBaseInfo(const int& baseIndex);
	BaseInfo* GetBaseInfo(const TilePosition& tileposition);
	Position GetMainBasePosition();
	Position GetEnemyBasePosition();
	int AmountOfAllBases() const;
	//resource
	double MineralRateWithoutOneWorker();
	double GasRate();
	//unit count
	int GetAmountOfUnitType(const UnitType& unitType)
	{
		return _unitTypeCounts[unitType];
	}
	//--
	const static int MAX_BASE_AMOUNT = 3;
private:
	void Draw();
	//--
	vector<BaseInfo> _baseInfos;
	unordered_map<const BaseLocation* , int> _baseLocationToBaseIndexTable;
	unordered_map<const BaseLocation* , BaseInfo*> _baseLocationToBaseInfoTable;

	int _enemyBaseIndex;

	unordered_map<UnitType , int> _unitTypeCounts;
};

typedef Singleton<InfoClass> Info;